package com.yc.http.v1.impl;

import com.yc.http.v1.*;

import javax.servlet.annotation.WebServlet;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/login.s")
public class LoginServlet extends HttpServletImpl {
    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        String name = request.getParameter("name");
        String pwd = request.getParameter("pwd");
        response.setContentType("text/html;charser=UTF-8");
        PrintWriter out = response.getWriter();
        if ("yc".equals(name) && "123".equals(pwd)) {
            HttpSession session = request.getSession();
            session.setAttribute("myinfo", name);
            out.append("用户登录成功！");
        }else {
            out.append("用户名或密码错误");
        }
    }
}
